package cn.iocoder.yudao.module.security.dal.mysql.whitelistevent;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.security.dal.dataobject.whitelistevent.WhitelistEventDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.security.controller.admin.whitelistevent.vo.*;

/**
 * 白名单事件 Mapper
 *
 * @author cai
 */
@Mapper
public interface WhitelistEventMapper extends BaseMapperX<WhitelistEventDO> {

    default PageResult<WhitelistEventDO> selectPage(WhitelistEventPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WhitelistEventDO>()
                .eqIfPresent(WhitelistEventDO::getSourceIp, reqVO.getSourceIp())
                .eqIfPresent(WhitelistEventDO::getSourcePort, reqVO.getSourcePort())
                .eqIfPresent(WhitelistEventDO::getDestinationIp, reqVO.getDestinationIp())
                .eqIfPresent(WhitelistEventDO::getDestinationPort, reqVO.getDestinationPort())
                .eqIfPresent(WhitelistEventDO::getProtocol, reqVO.getProtocol())
                .betweenIfPresent(WhitelistEventDO::getEventTime, reqVO.getEventTime())
                .eqIfPresent(WhitelistEventDO::getFunctionCode, reqVO.getFunctionCode())
                .eqIfPresent(WhitelistEventDO::getFunctionCodeCn, reqVO.getFunctionCodeCn())
                .eqIfPresent(WhitelistEventDO::getMsgType, reqVO.getMsgType())
                .eqIfPresent(WhitelistEventDO::getRegisterArea, reqVO.getRegisterArea())
                .eqIfPresent(WhitelistEventDO::getDbArea, reqVO.getDbArea())
                .eqIfPresent(WhitelistEventDO::getPointType, reqVO.getPointType())
                .eqIfPresent(WhitelistEventDO::getObjectGroupNum, reqVO.getObjectGroupNum())
                .eqIfPresent(WhitelistEventDO::getVariantNum, reqVO.getVariantNum())
                .eqIfPresent(WhitelistEventDO::getStatus, reqVO.getStatus())
                .eqIfPresent(WhitelistEventDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(WhitelistEventDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WhitelistEventDO::getId));
    }

}